# 请求
import requests

url = 'https://fanyi.youdao.com/translate_o?smartresult=dict&smartresult=rule'

headers = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36',
    'Referer': 'https://fanyi.youdao.com/',
    'Cookie': 'OUTFOX_SEARCH_USER_ID=-1927650476@223.97.13.65;',

}
data = {
    'i': '喜欢',
    'from': 'AUTO',
    'to': 'AUTO',
    'smartresult': 'dict',
    'client': 'fanyideskweb',
    'salt': '16503273094215',
    'sign': '89d02509bdbdad0217172186a12f7dac',
    'lts': '1650327309421',
    'bv': 'ac3968199d18b7367b2479d1f4938ac2',
    'doctype': 'json',
    'version': '2.1',
    'keyfrom': 'fanyi.web',
    'action': 'FY_BY_CLICKBUTTION',

}

response = requests.post(url, headers=headers, data=data)
# 添加请求头  请求参数
# 获取响应
print(response.status_code)
print(response.content.decode('utf-8'))

